package logic

import (
	"context"

	"HD_running/mall/order/api/internal/svc"
	"HD_running/mall/order/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ProblemLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewProblemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProblemLogic {
	return &ProblemLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ProblemLogic) Problem(req *types.NumReq) (resp *types.QuestionResp, err error) {
	// todo: add your logic here and delete this line
	userInfo, err := l.svcCtx.ProblemModel.FindOne(l.ctx, req.Numquestion)
	return &types.QuestionResp{
		Question:      userInfo.Question,
		SelequestionA: userInfo.Selequestiona,
		SelequestionB: userInfo.Selequestionb,
	}, nil
}
